package com.ylr.user.framework.controller.api;

import com.ylr.user.framework.service.UserMessageService;
import com.ylr.user.common.bo.user_message.UserMessageBo;
import com.ylr.base.common.tool.Result;
import com.ylr.user.framework.feign.YuUserMessageBaseClient;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-06-08 11:54:41
 * className: UserMessageApiController
 * version: 1.0
 * description:
 */
@RestController
@RequestMapping("/api/user-message")
@AllArgsConstructor
public class UserMessageApiController implements YuUserMessageBaseClient {

    private static final Logger log = LoggerFactory.getLogger(UserMessageApiController.class);

    private final UserMessageService userMessageService;

    /**
     * 保存用户消息接口
     * @param userMessageBo 用户消息
     */
    @PostMapping("/save")
    public Result<Object> saveUserMessage(@RequestBody UserMessageBo userMessageBo) {
        log.info("api => 开始保存用户消息操作。{}", userMessageBo);

        userMessageService.saveUserMessage(userMessageBo);

        log.info("api => 保存用户消息操作结束");
        return Result.success();
    }
}
